import React, { useEffect,useRef } from 'react'

import BScroll from 'better-scroll'

import {BSScrollWraper} from './styledBSScroll'

export default function BSScroll({
    children,
    id,
    height
}) {
    const bsscroll = useRef(null)

    useEffect(() => {
        bsscroll.current = new BScroll(`#${id}`, {
            probeType: 3,
            click: true
        })
    },[bsscroll,id])
    return (
        <BSScrollWraper id={id} height = {height}>
            <div className="container">
                <>{children}</>
            </div>
        </BSScrollWraper>
    )
}
